<?php

// +----------------------------------------------------------------------
// | H1CMS © OpenSource CMS
// +----------------------------------------------------------------------
// | Copyright (c) 2014-2016 http://www.h1cms.com All rights reserved.
// | Copyright (c) 2014-2016 嘉兴领格信息技术有限公司，并保留所有权利。
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Allen <allen@lg4.cn>
// +----------------------------------------------------------------------

namespace Lg\Log;

use Monolog\Handler\StreamHandler;

/**
 * Description of Log
 *
 * @author getssl
 */
class Log {

    /**
     *
     * @var \Lg\Log\Logger
     */
    public static $instance;

    /**
     * 
     * @return \Lg\Log\Logger
     */
    public static function instance() {

        if (is_null(static::$instance)) {
            static::$instance = new Logger(new \Monolog\Logger(config('log.name',
                            'h1cms')));

            static::$instance->getLogger()->pushHandler(new StreamHandler(config('log.path'),
                    config('log.level')));
        }
        return static::$instance;
    }

    public static function db($table, $columns) {
        db_insert($table, $columns);
    }

}
